package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 订单
 */
@Getter
@AllArgsConstructor
public enum ProductEnum {

	//字典
	DEMO("DEMO", ""),
	;

	private final String type;
	private final String description;

	/**
	 * 商品分类层级
	 */
	@Getter
	@AllArgsConstructor
	public enum LevelEnum {
		FIRST(1, "第一级"),
		SECOND(2, "第二级"),
		THIRD(3, "第三级"),
		FOURTH(4, "第四级"),
		FIFTH(5, "第五级"),
		SIXTH(6, "第六级"),
		SEVENTH(7, "第七级"),
		EIGHTH(8, "第八级"),
		NINTH(9, "第九级"),
		;
		private Integer level;
		private String description;

		public static String getDecs(Integer level) {
			return Arrays.stream(values()).filter(x -> x.getLevel().equals(level)).findFirst().get().getDescription();
		}
	}

	/**
	 * 商品审核状态
	 */
	@Getter
	@AllArgsConstructor
	public enum AuditEnum {
		NO_AUDIT(0, "无需审核"),
		WAIT_AUDIT(2, "待审核"),
		SUCCESS(3, "审核成功"),
		FAIL(4, "审核拒绝"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer code) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(code)).findFirst().get().getDescription();
		}
	}

	/**
	 * 商品类型
	 */
	@Getter
	@AllArgsConstructor
	public enum TypeEnum {
		NORMAL(0, "普通商品"),
		SECKILL(1, "秒杀商品"),
		BRANGAIN(2, "砍价商品"),
		COMBINATION(3, "拼团商品"),
		;
		private Integer type;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}

	/**
	 * 商品设置类型
	 */
	@Getter
	@AllArgsConstructor
	public enum SettingTypeEnum {
		HOT(1, "热词"),
		;
		private Integer type;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}

	/**
	 * 属性类型 0:销售属性，1:基本属性
	 */
	@Getter
	@AllArgsConstructor
	public enum AttrType {
		SALE(0, "销售属性"),
		BASE(1, "基本属性"),
		;
		private Integer type;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getType().equals(type)).findFirst().get().getDescription();
		}
	}
}
